package com.yxkj.syh.app.huarong.data_center.model;

import com.syh.app.basic.utils.net.ApiObserver;
import com.yxkj.syh.app.huarong.util.RetrofitHelper;
import com.trello.rxlifecycle2.LifecycleTransformer;
import com.yxkj.syh.app.huarong.api.UploadApi;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MultipartBody;

/**
 * 创建者：SYH
 * 时间：2020/5/22 13:57
 * 编辑者：SYH、
 * 标签：
 * 补充说明：
 */
public class UploadModel {
    private static UploadModel uploadModel;

    private UploadModel() {
    }

    public static UploadModel getUploadModel() {
        if (uploadModel == null) uploadModel = new UploadModel();
        return uploadModel;
    }

    private UploadApi getAuthApi() {
        return RetrofitHelper.createApi(UploadApi.class);
    }

    public void paymentMethodList(MultipartBody.Part file, LifecycleTransformer transformer, ApiObserver apiObserver) {
        getAuthApi().uploadImage(file).compose(transformer).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(apiObserver);
    }

}
